import { JoinOptions } from "colyseus.js";
import { IPlayerInfo, MMOPlayer } from "./mmo-player";


enum MMO_ROOM_NAME {
    GALLERY = 'gallery',
}

enum MMO_MESSAGE_TYPE {
    ROOM_STATE_PLAYERS = 'roomStatePlayers',
    PLAYER_JOINED = 'playerJoined',
    PLAYER_LEFT = 'playerLeft',
    PLAYER_POSITION = 'playerPosition',
    PLAYER_ROTATION = 'playerRotation',
    PLAYER_SCALE = 'playerScale',
    PLAYER_ACTION = 'playerAction',
    PLAYER_VISIBLE = 'playerVisible',
}

interface IRoomStatePlayerMessage {
    players: Array<[string, MMOPlayer]>
}

interface IPlayerJoinedMessage extends JoinOptions {
    sessionId: string;
    player: IPlayerInfo;
}

interface IPlayerLeftMessage extends JoinOptions{
    sessionId: string;
    player: IPlayerInfo;
}

interface IXYZMessage {
    sessionId: string;
    x: number;
    y: number;
    z: number;
}

interface IActionMessage {
    sessionId: string;
    index: number;
    loop: boolean;
}

interface IBooleanMessage{
    sessionId: string;
    value: boolean;
}


export {
    MMO_MESSAGE_TYPE,
    MMO_ROOM_NAME,
};
export type {
    IRoomStatePlayerMessage,
    IPlayerJoinedMessage,
    IPlayerLeftMessage,
    IXYZMessage,
    IActionMessage,
    IBooleanMessage,
};